<template>
	<view class="allwrap">
		<view class="title">会议名称名称名称</view>
		<view class="text">张三 <span style="color: #333333;margin-left: 25rpx;">发起了签到</span></view>
		<view class="content">签到说明内容文字内容文字内容文字内容文字</view>
		<view class="flexcen" style="margin-top: 30rpx;">
			<u-circle-progress active-color="#0052D9" :percent="percentage" :bg-color="'#FFFFFF'" :inactive-color="'#A2A6B1'" :duration="0" :width="376" :border-width="30">
					<view class="flexcumal">
						<view class="u-progress-dot">剩余时间</view>
						<text class='u-progress-info'>{{format()}}</text>
						<view class="u-progress-end" v-if="end">签到已结束</view>
					</view>
			</u-circle-progress>
			<view class="frame-buttom flexcen" style="background: #FFFFFF;color: #858A99;border: 2rpx solid #A2A6B1;" v-if="end">
				关闭
			</view>
			<view class="frame-buttom flexcen" v-else>
				立即签到
			</view>
		</view>
		<!-- 电话提示滑动快 -->
		<movablearea1 :movaheight="movaheightAll" v-if="movableareaShow" @editMovaheightAll="editMovaheightAll" :movaTop="movaTopAll"></movablearea1>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				percentage:0,					//签到剩余时间百分比
				seconds: 0, //秒数
				timer: null, //定时器
				sumSeconds: 60, //总秒数
				surplusSeconds: 10, //剩余秒数
				num4: 1, //分钟
				end:1,
			}
		},
		onLoad() {
			let data = this.getTimes(this.surplusSeconds)
			this.num4 = data.m
			this.seconds = data.s
			this.Time() //调用定时器
		},
		methods: {
			// 剩余时间
			format() {
				// console.log('分钟',this.num4)
				var stotal = this.surplusSeconds
				let second = stotal % 60
				//总分钟
				let mintotal = (stotal - second) / 60
				//分钟
				let min = mintotal % 60
			
				//小时
				let hour = (mintotal - min) / 60
				let hstr = `${hour.toFixed(0)}`
				let mstr = `${min.toFixed(0)}`
				let sstr = `${second.toFixed(0)}`
				if (hour < 10) {
					hstr = `0${hour.toFixed(0)}`
				}
				if (min < 10) {
					mstr = `0${min.toFixed(0)}`
				}
				if (second < 10) {
					sstr = `0${second.toFixed(0)}`
				}
			
				// return `${hstr}:${mstr}:${sstr}`
				return `${mstr}:${sstr}`
			},
			clearTime() { //清除定时器
				clearInterval(this.timer);
			},
			//定时器没过1秒参数减1
			Time() {
				if (this.timer) clearInterval(this.timer)
				this.timer = setInterval(this.getRestTime, 1000)
			
				// this.clearTimeSet = setInterval(this.getRestTime, 1000)
			},
			getRestTime() {
				if (this.surplusSeconds <= 0) {
					console.log('我进来了',this.surplusSeconds)
					this.signShow = false
					this.clearTime()
					return
				}
				this.surplusSeconds -= 1
				this.percentage = (this.surplusSeconds / this.sumSeconds) * 100
			
				this.format()
			},
		}
	}
</script>

<style lang="less">
	
	.title{
		margin-top: 35rpx;
		font-weight: normal;
		font-size: 40rpx;
		color: #15181D;
	}
	.text{
		margin-top: 12rpx;
		font-weight: normal;
		font-size: 30rpx;
		color: #2953E7;
	}
	.content{
		margin-top: 12rpx;
		height: 150rpx;
		font-weight: normal;
		font-size: 26rpx;
		color: #272B34;
	}
	
	.u-progress-dot{
		font-weight: normal;
		font-size: 24rpx;
		color: #858A99;
	}
	.u-progress-info{
		font-weight: 500;
		font-size: 80rpx;
		color: #15181D;
	}
	.u-progress-end{
		font-weight: normal;
		font-size: 28rpx;
		color: #15181D;
	}
	.frame-buttom{
		position: fixed;
		bottom: 98rpx;
		width: 686rpx;
		height: 80rpx;
		background: #0052D9;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
		font-weight: normal;
		font-size: 30rpx;
		color: #FFFFFF;
	}
</style>
